// getAlbumDetail/index.js

const cloud = require('wx-server-sdk');
cloud.init();

const db = cloud.database();
const collection = db.collection('album'); // 替换为你的集合名称

exports.main = async (event, context) => {
  try {
    const itemId = event.itemId;

    // 从云数据库中获取详情页数据
    const result = await collection.doc(itemId).get();
    return result;
  } catch (error) {
    console.error('Error fetching detail data from cloud:', error);
    throw new Error('Failed to fetch detail data from cloud');
  }
};
